package com.sskj.api.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.List;

@TableName("sys_user")
@Data
@Schema(description = "管理用户")
public class SysUser {

    @Schema(description = "主键ID")
    @TableId(type = IdType.ASSIGN_ID)
    private Long id;

    @Schema(description = "用户名")
    private String name;

    @Schema(description = "手机号")
    private String phone;

    @Schema(description = "密码")
    @JsonIgnore
    private String password;

    @Schema(description = "头像")
    private String avatar;

    @TableField("wx_openid")
    private String wxOpenid;

    @Schema(description = "状态")
    private Integer status;

    @Schema(description = "所属部门")
    @TableField("department_id")
    private Long departmentId;

    @Schema(description = "部门名称")
    @TableField(exist = false)
    private String departmentName;

    @TableField("position_id")
    @Schema(description = "所属岗位")
    private Long positionId;

    @Schema(description = "岗位名称")
    @TableField(exist = false)
    private String positionName;

    @Schema(description = "所属角色")
    @TableField(exist = false)
    private List<Role> roles;

    @Schema(description = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    @Schema(description = "更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
}
